<!-- HTML header for doxygen 1.8.14-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="cache-control" content="max-age=86400"/>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GBDK 2020 Docs: gbdk-lib/include/rand.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">GBDK 2020 Docs
   &#160;<span id="projectnumber">4.4.0</span>
   </div>
   <div id="projectbrief">API Documentation for GBDK 2020</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('rand_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">rand.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="rand_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#ifndef RAND_INCLUDE</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#define RAND_INCLUDE</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="types_8h.html">types.h</a>&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="stdint_8h.html">stdint.h</a>&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#if defined(__PORT_sm83) || defined(__PORT_mos6502)</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">   28</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand</a>(<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> seed) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a>;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#elif defined(__PORT_z80)</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="keywordtype">void</span> <a class="code" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand</a>(<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> seed) <a class="code" href="asm_2z80_2types_8h.html#af45e54cf59a5202abc9125c07b64abf1">Z88DK_FASTCALL</a>;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="rand_8h.html#a690f251553b39fd4f31894826141b61a">   33</a></span>&#160;<span class="preprocessor">#define RAND_MAX 255</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="rand_8h.html#a6dbd2f1a15221db40f456cf574a793b4">   34</a></span>&#160;<span class="preprocessor">#define RANDW_MAX 65535</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="keyword">extern</span> <a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> <a class="code" href="rand_8h.html#a7aab2f4a234108a5eae48e0d26380ae7">__rand_seed</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">#if defined(__PORT_sm83)</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">   54</a></span>&#160;<a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rand_8h.html#aec33f1e833f8bee2678dc33873af870d">rand</a>(<span class="keywordtype">void</span>) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a> <a class="code" href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a>(<a class="code" href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a>, <a class="code" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a>);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="preprocessor">#elif defined(__PORT_z80)</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rand_8h.html#aec33f1e833f8bee2678dc33873af870d">rand</a>(<span class="keywordtype">void</span>) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a> <a class="code" href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a>(<a class="code" href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a>, <a class="code" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a>, <a class="code" href="msx_8h.html#aade844cba18122ad48cb2f92b1c87ab0">iyh</a>, <a class="code" href="msx_2metasprites_8h.html#af279c752a3b15c4bd5c67f54b92e553f">iyl</a>);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="preprocessor">#elif defined(__PORT_mos6502)</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rand_8h.html#aec33f1e833f8bee2678dc33873af870d">rand</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">#if defined(__PORT_sm83)</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="rand_8h.html#a2407b9d841bd78b0064eceafdc188467">   66</a></span>&#160;<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> <a class="code" href="rand_8h.html#a2407b9d841bd78b0064eceafdc188467">randw</a>(<span class="keywordtype">void</span>) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a> <a class="code" href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a>(<a class="code" href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a>, <a class="code" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a>);</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#elif defined(__PORT_z80)</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> <a class="code" href="rand_8h.html#a2407b9d841bd78b0064eceafdc188467">randw</a>(<span class="keywordtype">void</span>) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a> <a class="code" href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a>(<a class="code" href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a>, <a class="code" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a>, <a class="code" href="msx_8h.html#aade844cba18122ad48cb2f92b1c87ab0">iyh</a>, <a class="code" href="msx_2metasprites_8h.html#af279c752a3b15c4bd5c67f54b92e553f">iyl</a>);</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">#elif defined(__PORT_mos6502)</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> <a class="code" href="rand_8h.html#a2407b9d841bd78b0064eceafdc188467">randw</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">#if defined(__PORT_sm83) || defined(__PORT_mos6502)</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="rand_8h.html#a333400f85febd7e1360835955103db8b">   83</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="rand_8h.html#a333400f85febd7e1360835955103db8b">initarand</a>(<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> seed) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a>;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="preprocessor">#elif defined(__PORT_z80)</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="keywordtype">void</span> <a class="code" href="rand_8h.html#a333400f85febd7e1360835955103db8b">initarand</a>(<a class="code" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> seed) <a class="code" href="asm_2z80_2types_8h.html#af45e54cf59a5202abc9125c07b64abf1">Z88DK_FASTCALL</a>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="preprocessor">#if defined(__PORT_sm83)</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="rand_8h.html#a4a5e355fc122d90d6225503b5ed796ad">   93</a></span>&#160;<a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rand_8h.html#a4a5e355fc122d90d6225503b5ed796ad">arand</a>(<span class="keywordtype">void</span>) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a> <a class="code" href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a>(<a class="code" href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a>, <a class="code" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a>);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="preprocessor">#elif defined(__PORT_z80)</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rand_8h.html#a4a5e355fc122d90d6225503b5ed796ad">arand</a>(<span class="keywordtype">void</span>) <a class="code" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a> <a class="code" href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a>(<a class="code" href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a>, <a class="code" href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a>, <a class="code" href="msx_8h.html#aade844cba18122ad48cb2f92b1c87ab0">iyh</a>, <a class="code" href="msx_2metasprites_8h.html#af279c752a3b15c4bd5c67f54b92e553f">iyl</a>);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="preprocessor">#elif defined(__PORT_mos6502)</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<a class="code" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rand_8h.html#a4a5e355fc122d90d6225503b5ed796ad">arand</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160; </div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="aasm_2types_8h_html_a0971918860055db2e50dacea4da8f3bc"><div class="ttname"><a href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a></div><div class="ttdeci">#define OLDCALL</div><div class="ttdef"><b>Definition:</b> types.h:21</div></div>
<div class="ttc" id="aasm_2types_8h_html_acb825e83a33fcc06482c59b4ab2cf961"><div class="ttname"><a href="asm_2types_8h.html#acb825e83a33fcc06482c59b4ab2cf961">PRESERVES_REGS</a></div><div class="ttdeci">#define PRESERVES_REGS(...)</div><div class="ttdef"><b>Definition:</b> types.h:32</div></div>
<div class="ttc" id="aasm_2z80_2types_8h_html_af45e54cf59a5202abc9125c07b64abf1"><div class="ttname"><a href="asm_2z80_2types_8h.html#af45e54cf59a5202abc9125c07b64abf1">Z88DK_FASTCALL</a></div><div class="ttdeci">#define Z88DK_FASTCALL</div><div class="ttdef"><b>Definition:</b> types.h:47</div></div>
<div class="ttc" id="agb_8h_html_a4c2e4adef74067fdbb49005bc73de937"><div class="ttname"><a href="gb_8h.html#a4c2e4adef74067fdbb49005bc73de937">b</a></div><div class="ttdeci">void b</div><div class="ttdef"><b>Definition:</b> gb.h:748</div></div>
<div class="ttc" id="amsx_2metasprites_8h_html_af279c752a3b15c4bd5c67f54b92e553f"><div class="ttname"><a href="msx_2metasprites_8h.html#af279c752a3b15c4bd5c67f54b92e553f">iyl</a></div><div class="ttdeci">static uint8_t iyl</div><div class="ttdef"><b>Definition:</b> metasprites.h:49</div></div>
<div class="ttc" id="amsx_8h_html_aade844cba18122ad48cb2f92b1c87ab0"><div class="ttname"><a href="msx_8h.html#aade844cba18122ad48cb2f92b1c87ab0">iyh</a></div><div class="ttdeci">void iyh</div><div class="ttdef"><b>Definition:</b> msx.h:102</div></div>
<div class="ttc" id="arand_8h_html_a2407b9d841bd78b0064eceafdc188467"><div class="ttname"><a href="rand_8h.html#a2407b9d841bd78b0064eceafdc188467">randw</a></div><div class="ttdeci">uint16_t randw(void) OLDCALL PRESERVES_REGS(b</div></div>
<div class="ttc" id="arand_8h_html_a2e5a04327b5658199f0f7bda2acceee1"><div class="ttname"><a href="rand_8h.html#a2e5a04327b5658199f0f7bda2acceee1">c</a></div><div class="ttdeci">uint8_t c</div><div class="ttdef"><b>Definition:</b> rand.h:54</div></div>
<div class="ttc" id="arand_8h_html_a333400f85febd7e1360835955103db8b"><div class="ttname"><a href="rand_8h.html#a333400f85febd7e1360835955103db8b">initarand</a></div><div class="ttdeci">void initarand(uint16_t seed) OLDCALL</div></div>
<div class="ttc" id="arand_8h_html_a4a5e355fc122d90d6225503b5ed796ad"><div class="ttname"><a href="rand_8h.html#a4a5e355fc122d90d6225503b5ed796ad">arand</a></div><div class="ttdeci">uint8_t arand(void) OLDCALL PRESERVES_REGS(b</div></div>
<div class="ttc" id="arand_8h_html_a7aab2f4a234108a5eae48e0d26380ae7"><div class="ttname"><a href="rand_8h.html#a7aab2f4a234108a5eae48e0d26380ae7">__rand_seed</a></div><div class="ttdeci">uint16_t __rand_seed</div></div>
<div class="ttc" id="arand_8h_html_a964538799843c0ba5bd01151ef7e2640"><div class="ttname"><a href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand</a></div><div class="ttdeci">void initrand(uint16_t seed) OLDCALL</div></div>
<div class="ttc" id="arand_8h_html_aec33f1e833f8bee2678dc33873af870d"><div class="ttname"><a href="rand_8h.html#aec33f1e833f8bee2678dc33873af870d">rand</a></div><div class="ttdeci">uint8_t rand(void) OLDCALL PRESERVES_REGS(b</div></div>
<div class="ttc" id="astdint_8h_html"><div class="ttname"><a href="stdint_8h.html">stdint.h</a></div></div>
<div class="ttc" id="astdint_8h_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> stdint.h:51</div></div>
<div class="ttc" id="astdint_8h_html_adf4d876453337156dde61095e1f20223"><div class="ttname"><a href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a></div><div class="ttdeci">unsigned short int uint16_t</div><div class="ttdef"><b>Definition:</b> stdint.h:52</div></div>
<div class="ttc" id="atypes_8h_html"><div class="ttname"><a href="types_8h.html">types.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
</div>
</body>
</html>
